package com.example.smartcity.ui.Adapter;

import android.content.Context;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.smartcity.R;
import com.example.smartcity.ui.Bean.submitBean;

import java.util.List;

public class SubMitListViewAdapter extends ArrayAdapter<submitBean> {
    private int resource;
    public SubMitListViewAdapter(@NonNull Context context, int resource, @NonNull List<submitBean> objects) {
        super(context, resource, objects);
        this.resource =resource;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        submitBean submitBean = getItem(position);
        View view = LayoutInflater.from(getContext()).inflate(resource,parent,false);
        TextView title = view.findViewById(R.id.title);
        TextView message = view.findViewById(R.id.message);
        title.setText(submitBean.getTitle());
        message.setText(submitBean.getMessage());
        return view;
    }
}
